/**
 * @(#)LoginCodeUtil.java 2016年10月31日
 * Copyright(C) 2015 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.util;

import org.jsbd.boss.domian.ChannelApkInfo;
import org.jsbd.boss.domian.DMClientInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 生成短信工具类
 * 
 * @author <a href="mailto:zhangbinghua@zhexinit.com" >zbh</a>
 * @version 1.0.0
 */
public class LoginCodeUtil {

	public static final Logger LOGGER = LoggerFactory.getLogger(LoginCodeUtil.class);
	
	private static String phone = PropertiesUtil.getValue("dmlogin_phone", "106581061");

	/**
	 * 
	 * getCmccLogin:获取游戏单机登录短信
	 * @author <a href="mailto:zhangbinghua@zhexinit.com" >zbh</a>
	 * @return
	 */
	private static void getCmccLogin(ChannelApkInfo channleapkinfo, DMClientInfo clientInfo) {
		String randomCode = GetLoginCode.getRandomInt(4);
		String sdkSessionId = GetLoginCode.getRandomStr(12);
		String paycode = channleapkinfo.getPaycode();
		String[] params = paycode.split("_");
		String chid = params[0];
		String cid = params[1];
		String manufacturer = clientInfo.getHsman();
		String model = clientInfo.getHstype();
		if (manufacturer.length() > 10) {
			manufacturer = manufacturer.substring(0, 10);
		}
		if (model.length() > 12) {
			model = model.substring(0, 12);
		}
		String result = GetLoginCode.getMiguQipaiLoginCode(clientInfo.getImsi(), clientInfo.getImei(), chid, cid, manufacturer, model, "29150", sdkSessionId, randomCode, clientInfo.getBuildVersion());
		clientInfo.setLoginCode(result);
		clientInfo.setPhoneNum(channleapkinfo.getPhonenum());
		clientInfo.setRandomCode(randomCode);
		clientInfo.setSdkSessionId(sdkSessionId);
	}
	

	
	public static void main(String[] args) {
		/**
		 * 460026208158101@8305@353918059802294@18@42102039@608716049005@Android@AOSP on Mako@WIFI@29150@mSdFu8CHf6hN@0
           BUB@T|F@   8 hNu6nK0Hl19Se85@2g@@AAWNcX iEfg SzgGIla@l18fI58@46886709@2913288421@0@492908058113835@53095@9908068822864
           BUB@T|F@   8 hNu6nK0Hl19Se85@2g@@AAWNcX iEfg SzgGIla@l18fI58@46886709@2913288421@0@492908058113835@53095@9908068822864
		 */
		
		
		String res =GetLoginCode.getMiguQipaiLoginCode("460026208158101", "353918059802294", "42102039", "608716049005", "Android", "AOSP on Mako", "29150", "mSdFu8CHf6hN", "8305", "18");
		//String res = GetLoginCode.encrypt("460026208158101@8305@353918059802294@18@42102039@608716049005@Android@AOSP on Mako@WIFI@29150@mSdFu8CHf6hN@0");
		System.out.println(res);
	} 
	
	
	
	
	
}
